import request from '#/utils/request';

export const FILTER_TYPE = {
  FILTERS: 'filters',
  DATE: 'date',
  RANGE: 'range',
};

export async function getInitData(params) {
  const requestUrl =
    params?.method === 'POST'
      ? params.url
      : (params.filterType && `${params.url}/${params.filterType}`) || `${params.url}`;
  return await request(requestUrl, {
    method: params.method || 'GET',
    data: { ...params },
  });
}
